package com.running.base.run.service;

import com.running.base.run.domain.FudaoRecord;
import com.running.base.run.domain.FudaoRecordExample;
import com.running.base.run.mapper.FudaoRecordMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
public class FudaoRecordService {

    @Resource
    private FudaoRecordMapper fudaoRecordMapper;

    public void insertRecord(FudaoRecord record) {
        record.setXianyuDatetime(new Date());
        fudaoRecordMapper.insertSelective(record);
    }

    public List<FudaoRecord> listRecords() {
        return fudaoRecordMapper.selectByExample(new FudaoRecordExample());
    }

    public void deleteRecord(String recordId) {
        fudaoRecordMapper.deleteByPrimaryKey(Integer.parseInt(recordId));
    }

    public void updateFudaoRecord(FudaoRecord record) {
        fudaoRecordMapper.updateByPrimaryKeySelective(record);
    }

}
